#ifndef SYS_WORK_H
#define SYS_WORK_H

#include "sys_pub.h"

// Work execution result
typedef enum {
    WORK_CONTINUE = 0,    // Continue executing the work
    WORK_DONE             // Work completed, recycle the work item
} work_result;

// Work item structure
typedef struct {
    uint8_t active;                           // Work active flag
    work_result (*work_func)(void*);    // Work function that returns execution result
    void* param;                              // Parameter for work function
} work_item_type_def;

// Function declarations
void work_system_init(void);
work_item_type_def* work_item_get_free(void);
uint8_t work_submit(work_result (*work_func)(void*), void* param);
void work_process_all(void);
uint8_t work_has_active_items(void);
uint8_t work_get_active_count(void);
void work_processing_task(void);

#endif /* SYS_WORK_H */